﻿@model Received

@Html.HiddenFor(model => model.ReceiveId)
<div class="widget-box span11">        
    <div class="widget-header header-color-blue2">
        <h4 class="smaller">รับพัสดุเข้าคลัง</h4>
    </div>
    
    <div class="widget-body">
        <div class="widget-main"> 
            <div class="control-group">
                <div class="control-label">
                    @Html.LabelFor(model => model.ReceiveTypeId)
                </div>
                <div class="controls"> 
                    @Html.DropDownListFor(m => m.ReceiveTypeId,
                        new KPIS.GERP.WEB.GIMS.ReceiveParcelService.ReceiveParcelServiceClient().MasLookUpSelectList(KPIS.GERP.Models.ICM.IcmMasLookUpType.LookUpType.ReceiveType),
                        new { id="ddlRecType", onchange = "DisableDN();", @class="chzn-select" })

                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    @Html.LabelFor(model => model.ReceiveName)
                </div>
                <div class="controls">
                    @Html.TextBoxFor(model => model.ReceiveName, new { style = "width: 90%;", id = "txtRecName", placeholder = "(กรุณาระบุ)" })
                    <text id="txtName" hidden="hidden" style="color:red;">* กรุณากรอกข้อมูล</text>
                    @Html.ValidationMessageFor(model => model.ReceiveName)
                </div>
            </div>

            <div class="control-group"  id="dvDn">
                <div class="control-label">
                    @Html.LabelFor(model => model.DnId)
                </div>
                <div class="controls"  style="margin-top:5px !important;">
                    @if( ViewBag.State == "Edit" ){
                        @Html.DisplayFor(model=>model.DeliveryNote.Name);
                    } 
                    else
                    {
                        var dataDnSl = new KPIS.GERP.WEB.GIMS.ReceiveParcelService.ReceiveParcelServiceClient().DeliveryNoteSelectList();
                        dataDnSl = dataDnSl.OrderByDescending(o => o.Text).ToArray();
                        @Html.DropDownListFor(m => m.DnId, 
                            dataDnSl,
                            "เลือกใบตรวจรับ",
                            new { id = "ddlDn", 
                                onchange = "FetchWarehouse();", 
                                @class = "chzn-select", 
                                data_manualwidth = "92%" })
                        @Html.ValidationMessageFor(model => model.DnId)
                        <a id="clickOpenDn" target="_blank" title="ไปที่หน้ารายการตรวจรับ" href=""><i class="icon-external-link"></i></a>
                    }                        
                    <text id="txtDN" hidden="hidden" style="color:red;">* เลือกใบตรวจรับ</text>
                </div>
            </div>

            <div class="control-group" >
                <div class="control-label">
                    @Html.LabelFor(model => model.WhId)
                </div>
                <div class="controls"  style="margin-top:5px !important;">
                    @if( ViewBag.State == "Edit" ){
                        @Html.DisplayFor(model=>model.Warehouse.Name);
                    } 
                    else
                    {
                        <div id="dvWhByDn">
                            @Html.Hidden("hdWhId")
                            @Html.TextBox("txtWhName", "", new { @readonly = "readonly", style = "width:90%", placeholder = "(กรุณาเลือกรายการตรวจรับ)" })
                        </div>
                        <div id="dvWh" style="display:none">
                            @Html.DropDownList("ddlWh", new KPIS.GERP.WEB.GIMS.ReceiveParcelService.ReceiveParcelServiceClient().SelectListWarehouse(new KPIS.GERP.Models.ICM.Warehouse { RecordStatus = "!D" })
                                , new { @class = "chzn-select" })
                            <text id="txtWh" hidden="hidden" style="color:red;">* เลือกคลังพัสดุ</text>
                        </div>
                    }
                </div>
            </div>

            <div class="control-group">
                <div class="control-label">
                    @Html.LabelFor(model => model.Remark)
                </div>
                <div class="controls">
                    @Html.TextAreaFor(model => model.Remark, new {@style="width:90%; height:100px"})               
                </div>
            </div>
        </div>  
    </div>
</div> 